package j08lianbiao;
/*
链表，查找慢，增删快
数组：查找快，增删慢
 */
class Cat{
    String name;
    Cat next;
    Cat pre;

    public Cat(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Cat{" +
                "name='" + name + '\'' +
                '}';
    }
}

public class J1 {
    public static void main(String[] args) {
        Cat c1 = new Cat("c1");
        Cat c2 = new Cat("c2");
        Cat c3 = new Cat("c3");

        Cat cx = new Cat("cx");
        c1.next = cx;
        cx.next = c2;

        c1.next = c2;
        c2.next = c3;

        System.out.println(c1.next.next);
    }
}
